package com.atguigu.springcloud;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.core.env.Environment;

/**
 * @Auther:
 * @Description:
 * @Date: 2019/11/22 15:24
 */
@SpringBootApplication
@EnableEurekaClient     // 在服务启动后会自动注册进 Eureka 服务中
@EnableDiscoveryClient  // 服务发现
@EnableCircuitBreaker // 对 hystrix 熔断机制的支持
public class DeptProvider89001_Config_App {
    private static final Logger logger = LoggerFactory.getLogger(DeptProvider89001_Config_App.class);

    public static void main(String[] args) {
        Environment environment = SpringApplication.run(DeptProvider89001_Config_App.class).getEnvironment();
        logger.info("\n Local: http://localhost:{}/dept/get/2", environment.getProperty("server.port"));
        logger.info("\n {}", environment.getProperty("spring.datasource.url"));
    }
}
